<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Cart extends Model
{
    use \jdavidbakr\ReplaceableModel\ReplaceableModel;
    protected $table = 'good_carts';

    public function getImageAttribute($value) {
        $imgUrl = urlencode($value);
        $url = route('douban.img') . '?url=' . $imgUrl;
        return $url;
    }

    public function getPriceAttribute($value){
        return number_format($value / 100,2);
    }
}
